package fun.tan90.main.rest;

import org.noear.solon.annotation.Controller;
import org.noear.solon.annotation.Mapping;
import org.noear.solon.hotplug.PluginManager;

@Controller
@Mapping("/plugin")
public class PluginController {

    @Mapping("/start")
    public void start(String name) {
        PluginManager.start(name);
    }

    @Mapping("/stop")
    public void stop(String name) {
        PluginManager.stop(name);
    }

    @Mapping("/unload")
    public void unload(String name) {
        PluginManager.unload(name);
    }

    @Mapping("/restart")
    public void restart(String name) {
        PluginManager.unload(name);
        PluginManager.start(name);
    }
}